package org.jb.coinche.client.guistatemachine;

import com.extjs.gxt.ui.client.widget.Info;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.inject.Inject;
import com.google.inject.Singleton;

@Singleton
public class MessageSenderImpl implements MessageSender {

	@Inject
	private StateServiceAsync stateService;

	@Override
	public void send(Message message) {
		stateService.sendMessage( message, new AsyncCallback<Void>() {

			@Override
			public void onFailure(Throwable caught) {
				Info.display("Erreur", "Erreur en transmission d'un message<br>" + caught.getMessage());
			}

			@Override
			public void onSuccess(Void result) {}
		});
		
	}

	
}
